import { getCateList } from "../../request/api";
let state={
    // 商品分类列表数据
    cateListData: [],
}

let mutations={
    modifyCateList(state,value){
        state.cateListData=value
    }
}

let actions={
     // 获取商品分类列表数据
     getCateListData(context) {
        getCateList().then(
          (res) => {
            if (res.data.code == 200) {
                context.commit("modifyCateList",res.data.list)
            }
          },
          (err) => err
        );
      },
}

let getters={
    cateListData(state){
        return state.cateListData
    }
}

export default{
    state,
    mutations,
    actions,
    getters,
    // 开启命名空间,防止重名
    namespaced:true
}